# Maintainer: Lukas Fleischer <lfleischer@archlinux.org>
# Maintainer: Levente Polyak <anthraxx[at]archlinux[dot]org>
# Contributor: Danilo Bargen <gezuru@gmail.com>

pkgname=vim-jedi
_reponame=jedi-vim
pkgver=0.11.2
pkgrel=1
pkgdesc='Vim plugin for jedi, an awesome Python autocompletion'
url='https://github.com/davidhalter/jedi-vim'
arch=('any')
license=('MIT')
depends=('vim-plugin-runtime' 'python-jedi' 'python')
optdepends=('vim-supertab: tab completion'
            'python2-jedi: Python 2 support')
checkdepends=('python-pytest')
groups=('vim-plugins')
options=('!emptydirs')
source=(https://github.com/davidhalter/${_reponame}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha256sums=('e169429a6a4bce5a32b94a3d7cc784c746f9d4fd78354122895ba50ded867afa')
b2sums=('375cdf4742eb6328f5dc601b7a0b529a3d18b70711f93ab860e2827275f36454281c9d4ec85de0cfe280115fadde3a45f1bf74bfb4a4f1036b603eaa6051bf56')

check() {
  cd ${_reponame}-${pkgver}
  py.test
}

package() {
  cd ${_reponame}-${pkgver}

  install -d "${pkgdir}/usr/share/vim/vimfiles"
  cp -dpr --no-preserve=ownership pythonx "${pkgdir}/usr/share/vim/vimfiles"
  cp -dpr --no-preserve=ownership doc "${pkgdir}/usr/share/vim/vimfiles/doc"
  cp -dpr --no-preserve=ownership after "${pkgdir}/usr/share/vim/vimfiles/after"
  cp -dpr --no-preserve=ownership autoload "${pkgdir}/usr/share/vim/vimfiles/autoload"
  cp -dpr --no-preserve=ownership ftplugin "${pkgdir}/usr/share/vim/vimfiles/ftplugin"
  cp -dpr --no-preserve=ownership plugin "${pkgdir}/usr/share/vim/vimfiles/plugin"

  install -Dm 644 LICENSE.txt -t "${pkgdir}/usr/share/licenses/${pkgname}"
}
